﻿using Inovout.Data.Domain;

namespace KuaJing.Orders.Domain
{
    public partial class Customer : ICustomer
    {
        public Customer(string name)
        {
            this.Name = name;
        }

        public override bool Equals(DataObject that)
        {
            return base.Equals(that) || (!string.IsNullOrEmpty(this.Name)&&this.Name == ((Customer)that).Name) ||
                (string.IsNullOrEmpty(this.ShortName)&&this.ShortName == ((Customer)that).ShortName);
        }
        public override int GetHashCode()
        {
             return string.IsNullOrEmpty(this.Name) ? 
                (string.IsNullOrEmpty(this.ShortName)?base.GetHashCode(): this.ShortName.GetHashCode()) 
                : this.Name.GetHashCode();
        }
    }
}
